<?php
class Application_Form_DangKy extends Zend_Form
{

	public function init()
	{
		$this->setName('dangky');
		$tenkh = new Zend_Form_Element_Text('tenkh');
		$tenkh->setLabel('Họ và tên :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		$diachi = new Zend_Form_Element_Text('diachi');
		$diachi->setLabel('Địa chỉ :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty');
		
		$validator = new Zend_Validate_StringLength(
				array('min' => 10,'max'=>11)
		);
		
		
		$dienthoai = new Zend_Form_Element_Text('dienthoai');
		$dienthoai->setLabel('Điện thoại :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty')
		->addValidator('Digits')
		->addValidator($validator);

		$email = new Zend_Form_Element_Text('email');
		$email->setLabel('Email :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('NotEmpty')
		->addValidator('EmailAddress');
		
		$username = new Zend_Form_Element_Text('username');
		$username->setLabel('Username :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('Alnum');
		
		$password = new Zend_Form_Element_Password('password');
		$password->setLabel('Password :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator('Alnum');

		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton');
		
		$reset = new Zend_Form_Element_Reset('reset');

		$this->addElements(array($tenkh, $diachi, $dienthoai,$email,$username,$password,$reset, $submit));
	}
}